import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {LoginComponent} from '../../components/login/login.component';
import {MainComponent} from '../../components/main/main.component';
import {ChannelManageComponent} from '../../components/main/content/channel-manage/channel-manage.component';
import {DvbConfigComponent} from '../../components/main/content/dvb-config/dvb-config.component';
import {DeviceManagerComponent} from '../../components/main/content/device-manager/device-manager.component';
import {NetworkManageComponent} from '../../components/main/content/network-manage/network-manage.component';
import {DvbChannelManagerComponent} from '../../components/main/content/dvb-channel-manager/dvb-channel-manager.component';
import {RegisterCodeComponent} from '../../components/main/content/register-code/register-code.component';
import {ThirdToolsComponent} from '../../components/main/content/third-tools/third-tools.component';
import {AuthGuardService} from '../../services/route/auth-guard.service';


const routes: Routes = [
  {path: 'login', component: LoginComponent},
  {
    path: 'main', component: MainComponent, children: [
      {
        path: 'oplatform', children: [
          {
            path: 'channel', component: ChannelManageComponent,
          },
          {
            path: 'config', component: DvbConfigComponent
          },
          {
            path: 'config-manager', component: DvbChannelManagerComponent,
          },
          {
            path: 'network', component: NetworkManageComponent
          },
          {
            path: 'device', component: DeviceManagerComponent
          },
          {
            path: 'registe', component: RegisterCodeComponent
          },
          {
            path: 'tools', component: ThirdToolsComponent
          },
          {path: '**', pathMatch: 'full', redirectTo: 'channel'}
        ],
      },
    ],
    canActivate: [AuthGuardService]
  },
];

@NgModule({
  exports: [RouterModule],
  imports: [RouterModule.forRoot(routes)],
})
export class RoutesModule {
}
